<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/date_time/time.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/date_time</a> - time.hpp<span style="font-size: 80%;"> (source / <a href="time.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef DATE_TIME_TIME_HPP___</a>
<span class="lineNum">       2 </span>            : #define DATE_TIME_TIME_HPP___
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
<span class="lineNum">       5 </span>            :  * Use, modification and distribution is subject to the 
<span class="lineNum">       6 </span>            :  * Boost Software License, Version 1.0. (See accompanying
<span class="lineNum">       7 </span>            :  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       8 </span>            :  * Author: Jeff Garland, Bart Garst
<span class="lineNum">       9 </span>            :  * $Date$
<span class="lineNum">      10 </span>            :  */
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : /*! @file time.hpp
<span class="lineNum">      14 </span>            :   This file contains the interface for the time associated classes.
<span class="lineNum">      15 </span>            : */
<span class="lineNum">      16 </span>            : #include &lt;string&gt;
<span class="lineNum">      17 </span>            : #include &lt;boost/operators.hpp&gt;
<span class="lineNum">      18 </span>            : #include &lt;boost/date_time/time_defs.hpp&gt;
<span class="lineNum">      19 </span>            : #include &lt;boost/date_time/special_defs.hpp&gt;
<span class="lineNum">      20 </span>            : 
<span class="lineNum">      21 </span>            : namespace boost {
<span class="lineNum">      22 </span>            : namespace date_time {
<span class="lineNum">      23 </span>            : 
<span class="lineNum">      24 </span>            :   //! Representation of a precise moment in time, including the date.
<span class="lineNum">      25 </span>            :   /*! 
<span class="lineNum">      26 </span>            :     This class is a skeleton for the interface of a temporal type
<span class="lineNum">      27 </span>            :     with a resolution that is higher than a day.  It is intended that 
<span class="lineNum">      28 </span>            :     this class be the base class and that the actual time 
<span class="lineNum">      29 </span>            :     class be derived using the BN pattern.  In this way, the derived 
<span class="lineNum">      30 </span>            :     class can make decisions such as 'should there be a default constructor' 
<span class="lineNum">      31 </span>            :     and what should it set its value to, should there be optional constructors
<span class="lineNum">      32 </span>            :     say allowing only an time_durations that generate a time from a clock,etc.
<span class="lineNum">      33 </span>            :     So, in fact multiple time types can be created for a time_system with
<span class="lineNum">      34 </span>            :     different construction policies, and all of them can perform basic
<span class="lineNum">      35 </span>            :     operations by only writing a copy constructor.  Finally, compiler 
<span class="lineNum">      36 </span>            :     errors are also shorter. 
<span class="lineNum">      37 </span>            :     
<span class="lineNum">      38 </span>            :     The real behavior of the time class is provided by the time_system
<span class="lineNum">      39 </span>            :     template parameter.  This class must provide all the logic
<span class="lineNum">      40 </span>            :     for addition, subtraction, as well as define all the interface
<span class="lineNum">      41 </span>            :     types.
<span class="lineNum">      42 </span>            :     
<span class="lineNum">      43 </span>            :   */
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            :   template &lt;class T, class time_system&gt;
<span class="lineNum">      46 </span>            :   class base_time : private
<span class="lineNum">      47 </span>            :       boost::less_than_comparable&lt;T
<span class="lineNum">      48 </span>            :     , boost::equality_comparable&lt;T
<span class="lineNum">      49 </span>            :       &gt; &gt;
<span class="lineNum">      50 </span>            :   {
<span class="lineNum">      51 </span>            :   public:
<span class="lineNum">      52 </span>            :     // A tag for type categorization. Can be used to detect Boost.DateTime time points in generic code.
<span class="lineNum">      53 </span>            :     typedef void _is_boost_date_time_time_point;
<span class="lineNum">      54 </span>            :     typedef T time_type;
<span class="lineNum">      55 </span>            :     typedef typename time_system::time_rep_type time_rep_type;
<span class="lineNum">      56 </span>            :     typedef typename time_system::date_type date_type;
<span class="lineNum">      57 </span>            :     typedef typename time_system::date_duration_type date_duration_type;
<span class="lineNum">      58 </span>            :     typedef typename time_system::time_duration_type time_duration_type;
<span class="lineNum">      59 </span>            :     //typedef typename time_system::hms_type hms_type;
<span class="lineNum">      60 </span>            :     
<span class="lineNum">      61 </span>            :     base_time(const date_type&amp; day, 
<span class="lineNum">      62 </span>            :               const time_duration_type&amp; td, 
<span class="lineNum">      63 </span>            :               dst_flags dst=not_dst) :
<span class="lineNum">      64 </span><span class="lineCov">        412 :       time_(time_system::get_time_rep(day, td, dst))</span>
<span class="lineNum">      65 </span>            :     {}
<span class="lineNum">      66 </span>            :     base_time(special_values sv) :
<span class="lineNum">      67 </span>            :       time_(time_system::get_time_rep(sv))
<span class="lineNum">      68 </span>            :     {}
<span class="lineNum">      69 </span>            :     base_time(const time_rep_type&amp; rhs) :
<span class="lineNum">      70 </span>            :       time_(rhs)
<span class="lineNum">      71 </span>            :     {}
<span class="lineNum">      72 </span>            :     date_type date() const
<span class="lineNum">      73 </span>            :     {
<span class="lineNum">      74 </span>            :       return time_system::get_date(time_);
<span class="lineNum">      75 </span>            :     }
<span class="lineNum">      76 </span>            :     time_duration_type time_of_day() const
<span class="lineNum">      77 </span>            :     {
<span class="lineNum">      78 </span>            :       return time_system::get_time_of_day(time_);
<span class="lineNum">      79 </span>            :     }
<span class="lineNum">      80 </span>            :     /*! Optional bool parameter will return time zone as an offset 
<span class="lineNum">      81 </span>            :      * (ie &quot;+07:00&quot;). Empty string is returned for classes that do 
<span class="lineNum">      82 </span>            :      * not use a time_zone */
<span class="lineNum">      83 </span>            :     std::string zone_name(bool /*as_offset*/=false) const
<span class="lineNum">      84 </span>            :     {
<span class="lineNum">      85 </span>            :       return time_system::zone_name(time_);
<span class="lineNum">      86 </span>            :     }
<span class="lineNum">      87 </span>            :     /*! Optional bool parameter will return time zone as an offset 
<span class="lineNum">      88 </span>            :      * (ie &quot;+07:00&quot;). Empty string is returned for classes that do 
<span class="lineNum">      89 </span>            :      * not use a time_zone */
<span class="lineNum">      90 </span>            :     std::string zone_abbrev(bool /*as_offset*/=false) const
<span class="lineNum">      91 </span>            :     {
<span class="lineNum">      92 </span>            :       return time_system::zone_name(time_);
<span class="lineNum">      93 </span>            :     }
<span class="lineNum">      94 </span>            :     //! An empty string is returned for classes that do not use a time_zone
<span class="lineNum">      95 </span>            :     std::string zone_as_posix_string() const
<span class="lineNum">      96 </span>            :     {
<span class="lineNum">      97 </span>            :       return std::string();
<span class="lineNum">      98 </span>            :     }
<span class="lineNum">      99 </span>            : 
<span class="lineNum">     100 </span>            :     //! check to see if date is not a value
<span class="lineNum">     101 </span>            :     bool is_not_a_date_time()  const
<span class="lineNum">     102 </span>            :     {
<span class="lineNum">     103 </span>            :       return time_.is_not_a_date_time();
<span class="lineNum">     104 </span>            :     }
<span class="lineNum">     105 </span>            :     //! check to see if date is one of the infinity values
<span class="lineNum">     106 </span>            :     bool is_infinity()  const
<span class="lineNum">     107 </span>            :     {
<span class="lineNum">     108 </span>            :       return (is_pos_infinity() || is_neg_infinity()); 
<span class="lineNum">     109 </span>            :     }
<span class="lineNum">     110 </span>            :     //! check to see if date is greater than all possible dates
<span class="lineNum">     111 </span>            :     bool is_pos_infinity()  const
<span class="lineNum">     112 </span>            :     {
<span class="lineNum">     113 </span>            :       return time_.is_pos_infinity();
<span class="lineNum">     114 </span>            :     }
<span class="lineNum">     115 </span>            :     //! check to see if date is greater than all possible dates
<span class="lineNum">     116 </span>            :     bool is_neg_infinity()  const
<span class="lineNum">     117 </span>            :     {
<span class="lineNum">     118 </span>            :       return time_.is_neg_infinity();
<span class="lineNum">     119 </span>            :     }
<span class="lineNum">     120 </span>            :     //! check to see if time is a special value
<span class="lineNum">     121 </span>            :     bool is_special() const
<span class="lineNum">     122 </span>            :     {
<span class="lineNum">     123 </span>            :       return(is_not_a_date_time() || is_infinity());
<span class="lineNum">     124 </span>            :     }
<span class="lineNum">     125 </span>            :     //!Equality operator -- others generated by boost::equality_comparable
<span class="lineNum">     126 </span>            :     bool operator==(const time_type&amp; rhs) const
<span class="lineNum">     127 </span>            :     {
<span class="lineNum">     128 </span>            :       return time_system::is_equal(time_,rhs.time_);
<span class="lineNum">     129 </span>            :     }
<span class="lineNum">     130 </span>            :     //!Equality operator -- others generated by boost::less_than_comparable
<span class="lineNum">     131 </span>            :     bool operator&lt;(const time_type&amp; rhs) const
<span class="lineNum">     132 </span>            :     {
<span class="lineNum">     133 </span>            :       return time_system::is_less(time_,rhs.time_);
<span class="lineNum">     134 </span>            :     }
<span class="lineNum">     135 </span>            :     //! difference between two times
<span class="lineNum">     136 </span>            :     time_duration_type operator-(const time_type&amp; rhs) const
<span class="lineNum">     137 </span>            :     {
<span class="lineNum">     138 </span><span class="lineCov">      20600 :       return time_system::subtract_times(time_, rhs.time_);</span>
<span class="lineNum">     139 </span>            :     }
<span class="lineNum">     140 </span>            :     //! add date durations
<span class="lineNum">     141 </span>            :     time_type operator+(const date_duration_type&amp; dd) const
<span class="lineNum">     142 </span>            :     {
<span class="lineNum">     143 </span>            :       return time_system::add_days(time_, dd);
<span class="lineNum">     144 </span>            :     }
<span class="lineNum">     145 </span>            :     time_type operator+=(const date_duration_type&amp; dd)
<span class="lineNum">     146 </span>            :     {
<span class="lineNum">     147 </span>            :       time_ = (time_system::get_time_rep(date() + dd, time_of_day()));
<span class="lineNum">     148 </span>            :       return time_type(time_);
<span class="lineNum">     149 </span>            :     }
<span class="lineNum">     150 </span>            :     //! subtract date durations
<span class="lineNum">     151 </span>            :     time_type operator-(const date_duration_type&amp; dd) const
<span class="lineNum">     152 </span>            :     {
<span class="lineNum">     153 </span>            :       return time_system::subtract_days(time_, dd);
<span class="lineNum">     154 </span>            :     }
<span class="lineNum">     155 </span>            :     time_type operator-=(const date_duration_type&amp; dd)
<span class="lineNum">     156 </span>            :     {
<span class="lineNum">     157 </span>            :       time_ = (time_system::get_time_rep(date() - dd, time_of_day()));
<span class="lineNum">     158 </span>            :       return time_type(time_);
<span class="lineNum">     159 </span>            :     }
<span class="lineNum">     160 </span>            :     //! add time durations
<span class="lineNum">     161 </span>            :     time_type operator+(const time_duration_type&amp; td) const
<span class="lineNum">     162 </span>            :     {
<span class="lineNum">     163 </span>            :       return time_type(time_system::add_time_duration(time_, td));
<span class="lineNum">     164 </span>            :     }
<span class="lineNum">     165 </span>            :     time_type operator+=(const time_duration_type&amp; td)
<span class="lineNum">     166 </span>            :     {
<span class="lineNum">     167 </span>            :       time_ = (time_system::get_time_rep(date(), time_of_day() + td));
<span class="lineNum">     168 </span>            :       return time_type(time_);
<span class="lineNum">     169 </span>            :     }
<span class="lineNum">     170 </span>            :     //! subtract time durations
<span class="lineNum">     171 </span>            :     time_type operator-(const time_duration_type&amp; rhs) const
<span class="lineNum">     172 </span>            :     {
<span class="lineNum">     173 </span>            :       return time_system::subtract_time_duration(time_, rhs);
<span class="lineNum">     174 </span>            :     }
<span class="lineNum">     175 </span>            :     time_type operator-=(const time_duration_type&amp; td) 
<span class="lineNum">     176 </span>            :     {
<span class="lineNum">     177 </span>            :       time_ = (time_system::get_time_rep(date(), time_of_day() - td));
<span class="lineNum">     178 </span>            :       return time_type(time_);
<span class="lineNum">     179 </span>            :     }
<span class="lineNum">     180 </span>            :     
<span class="lineNum">     181 </span>            :   protected:
<span class="lineNum">     182 </span>            :     time_rep_type time_;
<span class="lineNum">     183 </span>            :   };
<span class="lineNum">     184 </span>            : 
<span class="lineNum">     185 </span>            : 
<span class="lineNum">     186 </span>            : 
<span class="lineNum">     187 </span>            : 
<span class="lineNum">     188 </span>            : 
<span class="lineNum">     189 </span>            : } } //namespace date_time::boost
<span class="lineNum">     190 </span>            : 
<span class="lineNum">     191 </span>            : 
<span class="lineNum">     192 </span>            : #endif
<span class="lineNum">     193 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
